import { MongoClient } from 'mongodb';
import { uri } from '../../constants/mongodb.js';
export const client = new MongoClient(uri);
export const useUsers = () => {
  const db = client.db('demon');
  const userCol = db.collection('user');
  return userCol;
};

export const findUsers = (query?: any, opts?: any) => {
  const users = useUsers();
  if (!query) return users.find();
  if (!opts) return users.find(query);
  return users.find(query, opts);
};
